from app import BASE_URL


class RechargeApi:
    def __init__(self):
        # 获取充值验证码
        self.recharge_img_verify_url = BASE_URL + "/common/public/verifycode/0.141516"
        # 充值
        self.recharge_url = BASE_URL + "/trust/trust/recharge"

    # 获取充值验证码
    def get_recharge_img_verify(self, session):
        return session.get(self.recharge_img_verify_url)

    # 充值
    def recharge(self, session, amount, valicode):
        param = {
            "paymentType": "chinapnrTrust",
            "amount": amount,
            "formStr": "reForm",
            "valicode": valicode
        }
        return session.post(self.recharge_url, data=param)
